// 用户相关类型
export interface User {
  id: string;
  username: string;
  email: string;
  phone: string;
  password: string;
  avatar?: string;
  isAdmin: boolean;
  isBanned: boolean;
  createdAt: string;
  updatedAt: string;
}

export interface Address {
  id: string;
  userId: string;
  receiverName: string;
  phone: string;
  fullAddress: string;
}

// 商品相关类型
export interface Product {
  id: string;
  name: string;
  description: string;
  price: number;
  originalPrice?: number;
  coverImage: string;
  images: string[];
  categoryId: string;
  stock: number;
  sales: number;
  status: 'active' | 'inactive';
  createdAt: string;
  updatedAt: string;
}

export interface Category {
  id: string;
  name: string;
  icon?: string;
}

// 购物车和订单相关类型
export interface CartItem {
  id: string;
  userId: string;
  productId: string;
  product: Product;
  quantity: number;
  selected: boolean;
}

export interface Order {
  id: string;
  userId: string;
  status: 'pending' | 'completed' | "cancelled";
  totalAmount: number;
  shippingAddress: Address;
  items: OrderItem[];
  createdAt: string;
  completedAt?: string;
}

export interface OrderItem {
  id: string;
  productId: string;
  product: Product;
  quantity: number;
  price: number;
}

// 系统配置类型
export interface Banner {
  id: string;
  title: string;
  image: string;
  linkType: 'product' | 'category';
  linkValue: string;
  sort: number;
}

// API响应类型
export interface ApiResponse<T = any> {
  code: number;
  message: string;
  data: T | null;
}

export interface Pagination {
  current: number;
  pageSize: number;
  total: number;
}

export interface PaginatedResponse<T> {
  list: T[];
  pagination: Pagination;
}